/*
 * $Id$
 */
package corejs.expr;

import corejs.rt.ActivationRecord;
import corejs.rt.Number;
import corejs.util.XmlPrinter;

/**
 *
 * @author myang
 */
public class IntExpr implements Expression {

   private int _val;

   public IntExpr(final String s) {
      _val = Integer.parseInt(s);
   }

   public int value() {
      return _val;
   }

   @Override
   public Integer eval(final ActivationRecord scope) {
      return _val;
   }

   @Override
   public void print(final XmlPrinter printer) {
      printer.print("integer", String.valueOf(_val));
   }

   @Override
   public Number accept(final ExpressionVisitor visitor) {
      return visitor.visitInteger(_val);
   }
   
}
